﻿<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>区块链-拼爹爹商城APP-my</title>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <link th:href="@{/favicon.ico}" rel="stylesheet"/>


    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <!-- begin jqueryWeUI 头部CSS配置-->
    <link rel="stylesheet" th:href="@{/weui/lib/weui.min.css}">
    <link rel="stylesheet" th:href="@{/weui/css/jquery-weui.css}">
    <link rel="stylesheet" th:href="@{/weui/css/demos.css}">
    <!--end jqueryWeUI 头部CSS配置-->

    <link rel="stylesheet" th:href="@{/weui/jdavid/a.view.css}">
    

    <style>

    </style>

  </head> 
  <body ontouchstart>  
    <!-- begin 页头-->
    <header class='demos-header-lw'>
        <div class="weui-flex">
            <div><a href="#" class="placeholder-lw"></a></div>
            <div class="weui-flex__item">
                <div class="placeholder-lw">my</div>
            </div> 
            <div><div class="placeholder-lw"></div></div>
        </div> 
    </header>
    <!-- end 页头-->
	
	<div id="div_userinfo" style="display: none;">

        <div class="weui-cells weui-cells_form">


            <!-- ====================================== -->



            <div class="weui-cell" style="display: none;">
                <div class="weui-cell__hd"><label for="hyid" class="weui-label">*会员编码</label></div>
                <div class="weui-cell__bd"><input id="hyid" class="weui-input" type="text" value="" placeholder="会员编码"></div>
            </div>

            <div class="weui-cell">
                <div class="weui-cell__hd"><label for="hyzh" class="weui-label">*会员账号</label></div>
                <div class="weui-cell__bd"><input id="hyzh" class="weui-input" type="text" value="" placeholder="会员账号"></div>
            </div>

            <div class="weui-cell">
                <div class="weui-cell__hd"><label for="hymm" class="weui-label">*会员密码</label></div>
                <div class="weui-cell__bd"><input id="hymm" class="weui-input" type="password" value="" placeholder="会员密码"></div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label for="hymc" class="weui-label">*会员名称</label></div>
                <div class="weui-cell__bd"><input id="hymc" class="weui-input" type="text" value="" placeholder="会员名称"></div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label for="hydz" class="weui-label">*会员地址</label></div>
                <div class="weui-cell__bd"><input id="hydz" class="weui-input" type="text" value="" placeholder="会员地址"></div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label for="hydh" class="weui-label">*会员电话</label></div>
                <div class="weui-cell__bd"><input id="hydh" class="weui-input" type="text" value="" placeholder="会员电话"></div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label for="hyzt" class="weui-label">*会员状态</label></div>
                <div class="weui-cell__bd"><input id="hyzt" class="weui-input" type="text" value="1" placeholder="会员状态"></div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label for="zcrq" class="weui-label">*注册时间</label></div>
                <div class="weui-cell__bd"><input id="zcrq" class="weui-input" type="text" value="" placeholder="注册时间"></div>
            </div>






        </div>

        <div class="weui-btn-area" style="text-align:center; ">
             <a href="javascript:btn_exit_click();" class="weui-btn  weui-btn_warn" id="btn_exit">退出</a>
        </div>

        <div class='demos-content-padded'>
          <a href="javascript:btn_update_click();" class="weui-btn weui-btn_warn"  id="btn_update">更新信息</a>
        </div>

    </div>




    <div id="div_login" style="display: none;">

        <div class="weui-cells weui-cells_form">


            <!-- ====================================== -->

            <div class="weui-cell">
                <div class="weui-cell__hd"><label for="login_hyzh" class="weui-label">*会员账号</label></div>
                <div class="weui-cell__bd"><input id="login_hyzh" class="weui-input" type="text" value="" placeholder="会员账号"></div>
            </div>

            <div class="weui-cell">
                <div class="weui-cell__hd"><label for="login_hymm" class="weui-label">*会员密码</label></div>
                <div class="weui-cell__bd"><input id="login_hymm" class="weui-input" type="password" value="" placeholder="会员密码"></div>
            </div>

        </div>

        <div class="weui-btn-area" style="text-align:center;display:;">
            <a  href="javascript:login_click();" class="weui-btn  weui-btn_warn" id="btnReg">登录
                </a>
        </div>

        <div class='demos-content-padded'>
            <a href="./reg" class="weui-btn weui-btn_primary"  >注册</a>
        </div>

    </div>









    <!-- begin 底部tabbar-->
    <div class="weui-tabbar weui-tabbar-lw">

        <a href="./home" class="weui-tabbar__item weui-bar__item--on" id="aDown1">
            <!--<span class="weui-badge" style="position: absolute;top: -.4em;right: 1em;">8</span>
            -->
            <div class="weui-tabbar__icon">
                <img th:src="@{/weui/images/i1.png}" alt="">
            </div>
            <p class="weui-tabbar__label">商品</p>
        </a>
        <a href="./cart" class="weui-tabbar__item" id="aDown2">
            <div class="weui-tabbar__icon">
                <img th:src="@{/weui/images/gwc.png}" alt="">
            </div>
            <p class="weui-tabbar__label">购物车</p>
        </a>
        <a href="./order" class="weui-tabbar__item" id="aDown2">
            <div class="weui-tabbar__icon">
                <img th:src="@{/weui/images/i2.png}" alt="">
            </div>
            <p class="weui-tabbar__label">订单</p>
        </a>

        <a href="./my" class="weui-tabbar__item" id="aDown4">
            <div class="weui-tabbar__icon">
                <img th:src="@{/weui/images/i4.png}" alt="">
            </div>
            <p class="weui-tabbar__label">我的</p>
        </a>

    </div>
    <!-- end 底部tabbar-->


    <!-- begin jqueryWeUI 底部js配置-->
    <script th:src="@{/weui/lib/jquery-2.1.4.min.js}"></script>
    <script th:src="@{/weui/lib/fastclick.js}"></script>
    <script>
        $(function () {
            FastClick.attach(document.body);
        });
    </script>
    <script th:src="@{/weui/js/jquery-weui.min.js}"></script>
    <!-- end jqueryWeUI 底部js配置-->

    <script th:src="@{/weui/js/swiper.js}"></script>
    <script th:src="@{/weui/jdavid/e.util.js}"></script>
    <script th:src="@{/weui/jdavid/f.request.js}"></script>
    <script th:src="@{/weui/jdavid/z.proj.js}"></script>



    <script>

        if(is_login()){
            show_after_login();
        }else{
            show_before_login();
        }


        function show_after_login(){
            $("#div_userinfo").css("display","");
            $("#div_login").css("display","none");

            show_userinfo();
        }

        function show_before_login(){
            $("#div_userinfo").css("display","none");
            $("#div_login").css("display","");
        }

        
        
        
        
        function login_click() {
           // alert("login")

            var hyzh=$("#login_hyzh").val();
            var hymm=$("#login_hymm").val();

            //alert(hyzh+hymm);

            var s1=hyzh+"|"+hymm;

            var url =  '/pdd/app/loginpost/'+s1;
            var config = {
                url: url,
                type: "post",
                dataType: "text",
                data: "",
                beforeSend: function () {
                    // $.modal.loading("正在处理中，请稍后...");
                },
                success: function (result) {


                    //alert(result);
                    console.log(result);

                    if(result=="[]"){
                        alert("账号/密码 错误！");
                        return;
                    }

                    set_storage_val("pdd_userinfo",result);

                    show_after_login();
                    show_userinfo();

                    alert("祝贺你，登录成功！");


                    // var code = result.code;
                    // var msg = result.msg;
                    // var data = result.data;
                    // //查询结果客户信息，进行界面赋值
                    // show_ref_resultinfo(data);

                    //show_spxx_list(result);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    console.log("访问服务器失败1:"+XMLHttpRequest.status+XMLHttpRequest.readyState);
                    console.log("访问服务器失败2:"+textStatus);
                    console.log("访问服务器失败3:"+errorThrown);

                    alert('访问服务器失败');
                }
            };
            $.ajax(config);

        }


        function show_userinfo(){

            var jsonObj=get_userinfo_jsonObj();

            $("#hyid").val(jsonObj.hyid);//会员编码
            $("#hyzh").val(jsonObj.hyzh);//会员账号
            $("#hymm").val(jsonObj.hymm);//会员密码
            $("#hymc").val(jsonObj.hymc);//会员名称
            $("#hydz").val(jsonObj.hydz);//会员地址
            $("#hydh").val(jsonObj.hydh);//会员电话
            $("#hyzt").val(jsonObj.hyzt);//会员状态
            $("#zcrq").val(jsonObj.zcrq);//注册时间

            // hyid	会员编码
            // hyzh	会员账号
            // hymm	会员密码
            // hymc	会员名称
            // hydz	会员地址
            // hydh	会员电话
            // hyzt	会员状态
            // zcrq	注册时间



        }


        function btn_update_click(){hymm
            //
        }




        function btn_exit_click() {
            logout();
            show_before_login();
            
        }
    </script>







  <!--oper userinfo local storage-->
  <script>

      function get_storage_val(itemname){
          var storage = window.localStorage;
          var s=storage.getItem(itemname);
          if(!s){return ""};
          return s;
      }
      function set_storage_val(itemname,val){
          var storage = window.localStorage;
          storage.setItem(itemname,val);

      }


      function is_login() {
          var storage = window.localStorage;
          var pdd_userinfo = storage.getItem("pdd_userinfo");

          if (pdd_userinfo) {
              if (pdd_userinfo === "") {
                  return false;
              } else {
                  return true;
              }
          } else {
              return false;
          }
      }
      function logout(){
          var storage = window.localStorage;
          storage.setItem("pdd_userinfo","");
      }

      function get_userinfo_jsonObj(){

          var s1=get_storage_val("pdd_userinfo");
          s1=s1.replace("[","");
          s1=s1.replace("]","");

          var dataObj=eval("("+s1+")");
          return dataObj;
      }
  </script>







  </body>
</html>
